<template>
	<div class="AdminUser">
		<Table border :columns="columns" :data="user">
			<template slot-scope="{ row }" slot="name">
				<strong>{{ row.name }}</strong>
			</template>
			<template slot-scope="{ row, index }" slot="action">
				<Button type="primary" size="small" style="margin-right: 5px" @click="show(row)">查看用户吃货圈</Button>
				<Button type="error" size="small" @click="remove(index)">删除用户</Button>
			</template>
		</Table>
		<Modal
				v-model="modal1"
				:title='hr'
				@on-ok="ok"
				@on-cancel="cancel">
			<Table :columns="columns2" height="400" :data="fayan"></Table>
		</Modal>
	</div>
</template>

<script>
	export default {
		name: "AdminUser",
		data () {
			return {
				modal1: false,
				hr:'发布的吃货圈',
				columns: [
					{
						title: '姓名',
						slot: 'name'
					},
					{
						title: '地址',
						key: 'address'
					},
					{
						title: '银行卡绑定状态',
						key: 'bindstate'
					},
					{
						title: '操作',
						slot: 'action',
						align: 'center'
					}
				],
				columns2:[
					{
						title: '内容',
						key: 'comment'
					},
				],
				user: [{}],
				fayan:[],
			}
		},
		methods: {
			async show (row) {
				this.modal1=true
				let dd = await this.$axios.post('root/RootSee/fayan',row).then(r=>r.data)
				this.fayan = dd.fayan
			},
			async remove (index) {
				this.user.splice(index, 1);
			},
			ok () {
				this.modal1= false
			},
			cancel () {
				this.modal1= false
			}
		},
		async mounted(){
			let users= await this.$axios.post('/root/RootSee/users').then(r=>r.data)
			this.user = users.users
		}
	}
</script>

<style lang="less">
	.AdminUser{
		width: 1000px;
		margin: 50px auto;
		.ivu-table-row{
			font-size: 20px;
		}
	}
</style>